/*
 *	Copyright (C) 2008 - Mauricio Bieze Stefani
 *	This file is part of the Insano Game Engine.
 *
 *	Insano is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or
 *	(at your option) any later version.
 *
 *	Insano is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with Insano.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef INPUTDEVICES_H_INCLUDED
#define INPUTDEVICES_H_INCLUDED

#include <irrlicht.h>

class Mouse
{
	public:
		bool left;
		bool mid;
		bool right;
		float wheel;

		irr::core::position2d<irr::s32> drag, pos;

		Mouse()
		{
			wheel=drag.X=drag.Y=0;
			left=mid=right=false;
		}

		bool handleIrrlicht(const irr::SEvent& event);

		inline int getDragX()
		{
			int rc=drag.X;
			drag.X=0;
			return rc;
		}

		inline int getDragY()
		{
			int rc=drag.Y;
			drag.Y=0;
			return rc;
		}

		inline float getWheel()
		{
			float rc=wheel;
			wheel=0;
			return rc;
		}
	private:
		irr::core::position2d<irr::s32> dragstart;
};

class Keyboard
{
	public:
		bool kbdgui;		//indicates current keyboard "owner": gui or "normal game"
		Keyboard();
		bool handleIrrlicht(const irr::SEvent& event);
		bool wasHit(irr::EKEY_CODE key)
		{
			bool temp=hit[key];
			hit[key]=false;
			return temp;
		}
		void clear();
		bool status[irr::KEY_KEY_CODES_COUNT];
		bool hit[irr::KEY_KEY_CODES_COUNT];
};

#endif // INPUTDEVICES_H_INCLUDED
